package cn.com.my.common;

import java.util.Random;

public class Rand {

	public static String getRandomString(int length) { //length表示生成字符串的长度  
	    String base = "abcdefghijklmnopqrstuvwxyz0123456789";     
	    Random random = new Random();     
	    StringBuffer sb = new StringBuffer();     
	    for (int i = 0; i < length; i++) {     
	        int number = random.nextInt(base.length());     
	        sb.append(base.charAt(number));     
	    }     
	    return sb.toString();     
	}
	
	public static void main(String[] args) {
		String s = getRandomString(30);
		System.out.println(s.length());
		System.out.println(s);
		
		System.out.println("Ps1sxlMKgowtO4tEEr_HMciLjA7LfI".length());
		System.out.println("fVUIirGvr7hxTu2Rc9bpVFVxFrLvBu".length());
	}

}
